<template>
<div>
        <h2>购买</h2>
    </div>
  <div>
    <van-cell-group inset>
  <van-field v-model="name" label="姓名" placeholder="请输入姓名,需与证件一致" />
  <van-field v-model="phone" label="手机" placeholder="请输入手机号，用于接受取票信息和入园" />
</van-cell-group>
<van-button @click="order()">提交订单</van-button>
  </div>
</template>

<script>
export default {
    data(){
        return{
            name:'',
            phone:'',
            uid:localStorage.getItem('ks_uid')||'',
            gid:this.$route.query.gid,
            price:this.$route.query.price,
        }
    },
    methods:{
        order(){

        this.myaxios(this.baseURL + 'order/','post',{name:this.name,phone:this.phone,uid:this.uid,gid:this.gid,price:this.price}).then(resp=>{
        console.log('提交订单',resp)
        if(resp.errcode==0){
          this.$toast.success(resp.msg+',订单号:'+resp.order_id)
          window.location.href = '/ks_index'
          
        }else{
            this.$toast.fail(resp.msg)
        }
      })
        }
    }

}
</script>

<style>

</style>